package org.suk.dp.composite;

/**
 * Description: 子节点<br/>
 * @version V1.0  2017/6/21 13:32  by 石冬冬(dongdong.shi@ucarinc.com) - Heil Hitler
 */
public class Leaf extends Component {
    public Leaf(String name) {
        super(name);
    }

    @Override
    void add(Component component) {
        System.out.println("Cannot add to a leaf");
    }

    @Override
    void remove(Component component) {
        System.out.println("Cannot remove from a leaf");
    }

    @Override
    void display(int depth) {
        System.out.println(new StringBuilder("-").append(depth).append(this.name).toString());
    }
}
